<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>查看订单</title>
    <!-- 引入JQuery -->
    <script src="js/jquery-3.4.1.min.js" th:src="@{/js/jquery-3.4.1.min.js}"></script>
    <!-- 引入BootStrap-->
    <link href="css/bootstrap/css/bootstrap.min.css" th:href="@{/css/bootstrap/css/bootstrap.min.css}" rel="stylesheet"/>
    <script src="css/bootstrap/js/bootstrap.min.js" th:src="@{/css/bootstrap/js/bootstrap.min.js}"></script>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <div class="header-main">
                <div id="head" th:include="head.html :: common_head"></div>
            </div>
            <br>
            <br>
            <h1>
                查看订单
            </h1>
            <h2>
                <a class="btn btn-sm btn-success" th:href="@{/toAddOrderPage}">添加订单</a>
                <a class="btn btn-sm btn-danger" th:href="@{/checkUser}">返回首页</a>
            </h2>
            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead>
                    <tr>
                        <th>订单ID</th>
                        <th>订单名</th>
                        <th>订单日期</th>
                        <th>订单所属用户</th>
                        <!--操作-->
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="orders:${orders}">
                        <td th:text="${orders.order_id}"></td>
                        <td th:text="${orders.order_name}"></td>
                        <td th:text="${orders.order_date}"></td>
                        <td th:text="${orders.order_userid}"></td>
                        <td>
                            <!--操作-->
                            <!--URL需要使用@-->
                            <a class="btn-sm btn-primary" th:href="@{/toUpdateOrderPage/}+${orders.order_id}">编辑</a>
                            <a class="btn-sm btn-danger" th:href="@{/deleteOrder/}+${orders.order_id}">删除</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </main>
    </div>
</div>
</body>
</html>